package com.brayan.melinxa.logic.shadowers.locations;

/**
 * Holds a source and a destination directory. Ensures no deficiencies appear.
 * e.g. source location is identical to destination location.
 * 
 * @author Brayan Zimmerli
 * 
 */
public class LocationPair {
	ShadowerLocation srcLocation = null;
	ShadowerLocation destLocation = null;
	
	public LocationPair(ShadowerLocation source, ShadowerLocation destination){
		setSrcLocation(source);
		setDestLocation(destination);
	}

	public ShadowerLocation getSrcLocation() {
		return srcLocation;
	}

	public void setSrcLocation(ShadowerLocation srcLocation) {
		if (isPairNotNull()) {
			if (srcLocation != destLocation)
				this.srcLocation = srcLocation;
		}
		else
			this.srcLocation = srcLocation;
	}

	public ShadowerLocation getDestLocation() {
		return destLocation;
	}

	public void setDestLocation(ShadowerLocation destLocation) {
		this.destLocation = destLocation;
		if (isPairNotNull()) {
			if (srcLocation != destLocation)
				this.destLocation = destLocation;
		}
		else
			this.destLocation = destLocation;
	}

	public boolean isPairNotNull() {
		if (srcLocation != null && destLocation != null)
			return true;
		else
			return false;
	}
}
